Linking To ClientProtector Using Borland Delphi

SoftwareShield ClientProtector COM Component > Linking To ClientProtector In Your Application > Linking to ClientProtector™ Using Borland Delphi®

## Linking to ClientProtector™ Using Borland Delphi®

Please be sure you have read Linking To The ClientProtector COM Component In Your Application before you perform this procedure.

If you run into trouble, you may prefer to start with the Sample Code. There are a set of three complete compile-able Delphi programs available.

The following example was prepared and tested in Borland Delphi 6.0.

The method we use here involves importing the COM object using the IDE enhancement Borland provides for importing type libraries. This is very easy to use and simplifies a great deal of code and memory management we would have to otherwise prepare ourselves. Note that, if you wish, there is a more "manual" way to use Delphi to access the ClientProtector COM server which does not require you to install a component wrapper on your component palette - however it is considerably more code you would have to write. We present the simplest way to access to object.

Also note that there is a ready to install component package in the Samples directory, however, we recommend you go through the following procedure to create your own package.

1. Open Delphi, close all open projects.
2. From the menu - select: "Project > Import Type Library". A dialog will pop-up. (See image below.)
3. In the dialog that pops up, find and select the "SoftwareShield ClientProtector".
4. Select a palette page on which you would like to install the component (we chose the COM page).
5. Clear the "Unit dir name" field.
6. Leave the "Search Path" field unchanged.
7. Ensure "Generate Component Wrapper" check box is checked. Click "Install".
8. Another dialog will pop-up after you click install. See below.
9. Select the "Into New Package" tab.
10. Enter a directory and package name to use for your imported component wrapper by browsing to a directory (create a new one if needed) of your choice using the "Browse" button. Type a name for your new component wrapper package (we used "SoftwareShieldClientProtector.dpk"). Also type a brief description of the component (we used "SoftwareShield ClientProtector") See image below.
11. Click "OK".
12. The IDE will create the new package and will prompt you that the package will be built and installed. Click "Yes" to continue.
13. If everything went correctly, the IDE will inform you that the component has been installed.
14. Save the package. You are done creating the package.
15. You can now use the wrapped component in all your applications and projects simply by dropping the control from the palette COM page directly onto a form and using it like any other component.
16. Connect event handlers simply by double clicking on the event in the object inspector when the component is selected in design view.

When you use the component, the IDE will automatically add the "SSCProt_TLB" to your "uses" section. This unit provides visibility to the enumerated constants defined in RETURNCODES and CPDEBUGFLAGS (inside COM server). You have access to these defined constants directly.